package com.lyz.objectd3;

/**
 * @ClassName Computer
 * @Description 电脑类
 * @Author 2214361854
 * @Date 2022/2/19 15:17
 * @Version 1.0
 */
public class Computer {
    private String name;

    public void start(){
        System.out.println(name+"开机了~~~");
    }

    /**
     * 安装USB入口
     */
    public void installUSB(USB usb){
        usb.connect();
        if(usb instanceof KeyBoard){
            KeyBoard k = (KeyBoard)usb;
            k.KeyDown();
        }else if(usb instanceof Mouse){
            Mouse m = (Mouse)usb;
            m.dbClick();
        }
    }

    /**
     * 拔出USB接口
     * @param usb
     */
    public void uninstallUSB(USB usb){
        usb.unconnect();
    }

    public Computer() {
    }

    public Computer(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
